package com.heima.ssm.dao;

import com.heima.ssm.pojo.Permission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Penguin
 * @create Date 2021/5/6  Time 16:38
 */
public interface IPermissionDao {

    @Select("select * from permission where id in(select permissionId from role_permission where roleId = #{id})")
    List<Permission> findPermissionByPerIdWhereFromRole_Permission(int id);

    @Select("select * from permission")
    List<Permission> findAll();

    @Insert("insert into permission(permissionName,url) values(#{permissionName},#{url})")
    void add(Permission per);
}
